package submarinebattle;

import javax.swing.*;
import java.util.Random;

/** 战舰 */
public class Battleship extends SeaObject {
    private int life;
    public Battleship(){
        super(66,26,270,124,20);
        life = 5;
    }
    public void move(){}

    public ImageIcon getImage(){
        return Images.battleship;
    }

    public Bomb shootBomb(){
        return new Bomb(this.getX(),this.getY());
    }
    //战舰左移
    public void moveLeft(){
        setX(getX()-getSpeed());
    }
    //战舰右移
    public void moveRight(){
        setX(getX()+getSpeed());
    }

    // 战舰增命
    public void addLife(int num){
        life += num;
    }

    // 获取命数
    public int getLife(){
        return life;
    }

    //战舰减命
    public void subtractLife(){
        life--;
    }
}

